/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package ModelLayer;
import CustomExceptions.*;
/**
 *
 * @author Claus
 */
public class Product
{
	String barCode;
	String name;
	float purchasePrice;
	float salesPrice;
	float rentPrice;
	String countryOfOrigin;
	int minStock;
	int maxStock;
	int currentStock;
	Supplier supplier;

	public Product()
	{

	}

	public Product(String barCode, String name, float purchasePrice, float salesPrice, float rentPrice, String countryOfOrigin, int minStock, int maxStock, int currentStock, Supplier supplier)
	{
		this.barCode = barCode;
		this.name = name;
		this.purchasePrice = purchasePrice;
		this.salesPrice = salesPrice;
		this.rentPrice = rentPrice;
		this.countryOfOrigin = countryOfOrigin;
		this.minStock = minStock;
		this.maxStock = maxStock;
		this.currentStock = currentStock;
		this.supplier = supplier;
	}

	public void increaseStock(int num)
	{
		currentStock += num;
	}

	public void decreaseStock(int num) throws OutOfStockException
	{
		if(num > currentStock)
		{
			throw new OutOfStockException("Out of stock");
		}
		else
		{
			currentStock -= num;
		}
	}

	// Getters og setters

	public String getCountryOfOrigin()
	{
		return countryOfOrigin;
	}

	public void setCountryOfOrigin(String countryOfOrigin)
	{
		this.countryOfOrigin = countryOfOrigin;
	}

	public int getMaxStock()
	{
		return maxStock;
	}

	public void setMaxStock(int maxStock)
	{
		this.maxStock = maxStock;
	}

	public int getMinStock()
	{
		return minStock;
	}

	public void setMinStock(int minStock)
	{
		this.minStock = minStock;
	}

	public String getName()
	{
		return name;
	}

	public void setName(String name)
	{
		this.name = name;
	}

	public float getPurchasePrice()
	{
		return purchasePrice;
	}

	public void setPurchasePrice(float purchasePrice)
	{
		this.purchasePrice = purchasePrice;
	}

	public float getRentPrice()
	{
		return rentPrice;
	}

	public void setRentPrice(float rentPrice)
	{
		this.rentPrice = rentPrice;
	}

	public float getSalesPrice()
	{
		return salesPrice;
	}

	public void setSalesPrice(float salesPrice)
	{
		this.salesPrice = salesPrice;
	}

	public String getBarCode()
	{
		return barCode;
	}

	public void setBarCode(String barCode)
	{
		this.barCode = barCode;
	}

	public int getCurrentStock()
	{
		return currentStock;
	}

	public void setCurrentStock(int currentStock)
	{
		this.currentStock = currentStock;
	}

	public void setSupplier(Supplier supplier)
	{
		this.supplier = supplier;
	}

	public Supplier getSupplier()
	{
		return supplier;
	}




}
